import re

class SyntaxError(Exception):
  pass

def is_ip(value):
    if value == None:
        return False
    else:
         if len(value.split()) == 1:
             value_list = value.split(".")
             if len(value_list) == 4:
                 for i, item in enumerate(value_list):
                     try:
                         value_list[i] = int(item)
                     except:
                         return False
                     if not isinstance(value_list[i], int):
                         return False
                 if max(value_list) < 256:
                     return True
                 else:
                     return False
             else:
                 return False
         else:
             return False

def is_domain(value):
    if value == None:
        return False
    else:
        if value[-1] == ".":
            value = value[:-1]
        if re.match(r"^[0-9a-z-.]*$", value):
            return True
        else:
            return False